%% SOLVES HJB FOR KNOWN-TYPE CONTRACT
function V = type_hjb_solver(V00, Beta, f, mu_v, params, grid_params, num_params)
%% PARAMTERS
temp = num2cell(params);
[rho, r, ra, alpha, sigma, lambda, M, eta_min, eta_max] = temp{:};

[n_grid, Y_mat, PHI_mat, dy, dphi] = grid_params{:};

[max_iter, D, thr] = num_params{:};

 %% v-term
    mat_v = mu_v;
    
    AA_v = spdiags(mat_v, 0, n_grid,n_grid);    
    AA = AA_v;

    %% New value function
    P = AA;
    Q = ((r + 1/D)*speye(n_grid) - P);
 
    V = Q\(f + V00/D);
